package Student1;

public class StudentScore  implements Comparable<StudentScore>{
    public String name;
    public int chinese;
    public int english;
    public int math;
    public int total;

    public StudentScore() {
    }

    public StudentScore(String name, int chinese, int english, int math, int total) {
        this.name = name;
        this.chinese = chinese;
        this.english = english;
        this.math = math;
        this.total = total;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return chinese
     */
    public int getChinese() {
        return chinese;
    }

    /**
     * 设置
     * @param chinese
     */
    public void setChinese(int chinese) {
        this.chinese = chinese;
    }

    /**
     * 获取
     * @return english
     */
    public int getEnglish() {
        return english;
    }

    /**
     * 设置
     * @param english
     */
    public void setEnglish(int english) {
        this.english = english;
    }

    /**
     * 获取
     * @return math
     */
    public int getMath() {
        return math;
    }

    /**
     * 设置
     * @param math
     */
    public void setMath(int math) {
        this.math = math;
    }

    /**
     * 获取
     * @return total
     */
    public int getTotal() {
        return total;
    }

    /**
     * 设置
     * @param total
     */
    public void setTotal(int total) {
        this.total = total;
    }

    public String toString() {
        return "StudentScore{name = " + name +
                ", chinese = " + chinese +
                ", english = " + english + ", math = " + math
                + ", total = " + total + "}";
    }

    @Override
    public int compareTo(StudentScore o) {
        return o.total-this.total;
    }
}
